
public class HtmlGen {
	
	public String generate(String mdText){
		
//		Pattern p = Pattern.compile("##(.)+");
//		Matcher m = p.matcher(mdText);
		
		//标题的处理
		mdText = mdText.replaceAll("######(.+?)#*\\n+", "<h6>$1</h6>\n")
				.replaceAll("#####(.+?)#*\\n+", "<h5>$1</h5>\n")
				.replaceAll("####(.+?)#*\\n+", "<h4>$1</h4>\n")
				.replaceAll("###(.+?)#*\\n+", "<h3>$1</h3>\n")
				.replaceAll("##(.+?)#*\\n+", "<h2>$1</h2>\n")
				.replaceAll("#(.+?)#*\\n+", "<h1>$1</h1>\n");
		
		return mdText;
	}

}
